Skip to content

[WIP] Use the Q-Chem input set generators from pymatgen - #1658

Draft
rkingsbury wants to merge 1 commit into
materialsproject:mainfrom
rkingsbury:claude/gracious-pascal-kg4uo1
Draft

rkingsbury wants to merge 1 commit into
materialsproject:mainfrom
rkingsbury:claude/gracious-pascal-kg4uo1

Conversation

@rkingsbury

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the discussion in materialsproject/atomate2#689, where it was agreed that the Q-Chem input sets should eventually move into pymatgen. That move is materialsproject/pymatgen-core#315; this PR is the atomate2 side.

  • QCInputSet, QCInputGenerator and the six job-type generators (SinglePointSetGenerator, OptSetGenerator, TransitionStateSetGenerator, ForceSetGenerator, FreqSetGenerator, PESScanSetGenerator) are now imported from pymatgen.io.qchem.sets. The atomate2 copies are removed.
  • atomate2.qchem.sets.base and atomate2.qchem.sets.core remain as re-exports, so existing imports keep working.
  • BaseQCMaker.make no longer generates the input set twice.
  • The pymatgen generators are not modified by get_input_set, so a generator (and the maker holding it) can be reused for any number of molecules. The old ones accumulated state in rem_dict etc. on every call.
  • Newly available settings: qchem_version, isosvp_dielectric, cmirs_solvent, cdft_constraints, almo_coupling_states, output_wavefunction, extra_scf_print. The solvent_data file needed for custom SMD solvents in Q-Chem 5 is now written.

Changes in behavior

Found by diffing the default input of every maker before and after the change:

  • Default basis sets follow pymatgen: def2-tzvpd for single point and force jobs, def2-svpd for optimization, transition state, frequency and PES scan jobs. Previously def2-tzvppd for all of them. BaseQCMaker keeps its explicit def2-qzvppd default.
  • dft_rung=2 writes method = b97-d3 instead of method = b97d3.
  • Empty $nbo and $geom_opt sections are no longer written to every input.
  • Generator arguments are named as in pymatgen: opt_variables, scan_variables and geom_opt replace opt_dict, scan_dict and new_geom_opt. The derived rem_dict, pcm_dict, solv_dict, smx_dict, vdw_dict and plots_dict fields are gone; use overwrite_inputs to change individual sections.
  • Generating a PES scan input without scan variables raises an error instead of writing an input without a $scan section.

Tests

  • tests/qchem/sets/test_core.py and tests/qchem/test_sets.py are rewritten against the pymatgen API. test_overwrite previously asserted nothing (its branches compared dict.keys() to a string or list); it now checks the overwritten sections.
  • The six reference inputs under tests/test_data/qchem/ffopt* lose their empty $nbo / $geom_opt sections. Nothing else in them changed.
  • test_frequency_opt_maker sets def2-tzvppd explicitly, since that is the basis set its reference data was computed with.

Additional dependencies introduced (if any)

  • None. This needs a newer pymatgen-core (see TODO).

TODO (if any)

  • Blocked on a pymatgen-core release that contains materialsproject/pymatgen-core#315. CI will fail with an ImportError in atomate2.qchem until then.
  • Raise the pymatgen-core requirement in pyproject.toml (the floor in dependencies and the pin in the strict extra) to that release. Not done here because the version does not exist yet.
  • Open questions for review: whether the changed default basis sets are acceptable for atomate2 workflows, and whether atomate2.qchem.sets should stay as a re-export or be removed.

Checklist

  • Code is in the standard Python style. ruff check and ruff format --check pass on src/atomate2/qchem and tests/qchem.
  • Doc strings have been added in the Numpy docstring format.
  • Type annotations. mypy src/atomate2/qchem reports the same 15 errors before and after this change (none introduced here).
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass. Locally, pytest tests/qchem gives 57 passed with the pymatgen-core branch of the PR above installed (48 passed on main before the change). The full test suite was not run, and CI cannot pass until the pymatgen-core release exists.

🤖 Generated with Claude Code

The Q-Chem input set (QCInputSet) and input set generators (QCInputGenerator,
SinglePointSetGenerator, OptSetGenerator, TransitionStateSetGenerator,
ForceSetGenerator, FreqSetGenerator, PESScanSetGenerator) now live in
pymatgen.io.qchem.sets. The makers import them from there, and
atomate2.qchem.sets.base / atomate2.qchem.sets.core only re-export them so
that existing imports keep working. This needs a pymatgen-core release that
ships the generators; the pymatgen-core requirement has to be raised to that
release before this can be merged.

Changes in behavior:
- Default basis sets follow pymatgen: def2-tzvpd for single point and force
  jobs, def2-svpd for optimization, transition state, frequency and PES scan
  jobs (previously def2-tzvppd for all of them).
- dft_rung=2 writes "method = b97-d3" instead of "method = b97d3".
- Empty $nbo and $geom_opt sections are no longer written.
- Generator arguments are named as in pymatgen: opt_variables, scan_variables
  and geom_opt replace opt_dict, scan_dict and new_geom_opt. The derived
  rem_dict, pcm_dict, solv_dict, smx_dict, vdw_dict and plots_dict fields are
  gone; use overwrite_inputs to change individual sections.
- Generators are no longer modified by get_input_set and can be reused.
- New settings: qchem_version, isosvp_dielectric, cmirs_solvent,
  cdft_constraints, almo_coupling_states, output_wavefunction and
  extra_scf_print. The solvent_data file of custom SMD solvents is written.
- A PES scan without scan variables raises an error.

BaseQCMaker no longer generates the input set twice. The reference inputs of
the frequency flattening tests lose their empty $nbo and $geom_opt sections,
and test_frequency_opt_maker sets the basis set of its reference data.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Pt7k6Qb7T25NTifwGtpu2

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants